//
//  NateUIViewController.m
//  CairnStory
//  www.cairnstory.com
//
//  Created by saturna on 11. 3. 22..
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "CSUIViewController.h"
#import "CSUIAlertView.h"


@implementation CSUIViewController


- (void)viewDidLoad
{
    [super viewDidLoad];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
}


- (void)dealloc
{
	if (m_attribute != nil)
	{
		[m_attribute release];
	}

    [super dealloc];
}




- (NateClientAppDelegate*)appDelegate
{
	return (NateClientAppDelegate*)[[UIApplication sharedApplication] delegate];
}

- (void)showAlertView:(NSString*)message andTitle:(NSString*)title
{
	CSUIAlertView* alertView = [[CSUIAlertView alloc]
								  initAlertWithTitle:title
								  message:message
								  target:nil
								  action:nil];
	[alertView show];
	[alertView autorelease];
}

- (void)showAlertView:(NSString*)message
{
	[self showAlertView:message andTitle:nil];
}



- (void)setAttribute:(id)attrValue forKey:(NSString*)attrKey;
{
	if (m_attribute == nil)
	{
		m_attribute = [[NSMutableDictionary alloc] init];
	}

	[m_attribute setObject:attrValue forKey:attrKey];
}

- (void)removeAttributeForKey:(NSString*)attrKey
{
	if (m_attribute != nil)
	{
		[m_attribute removeObjectForKey:attrKey];
	}
}

- (id)attributeForKey:(NSString*)attrKey
{
	if (m_attribute == nil)
	{
		return nil;
	}

	return [m_attribute objectForKey:attrKey];
}



- (BOOL)navigationBarUserInteractionEnabled
{
	return self.navigationController.navigationBar.userInteractionEnabled;
}

- (void)setNavigationBarUserInteractionEnabled:(BOOL)enabled
{
	self.navigationController.navigationBar.userInteractionEnabled = enabled;
	if (enabled)
	{
		self.navigationController.navigationBar.alpha = 1.0;
	}
	else
	{
		self.navigationController.navigationBar.alpha = 0.8;
	}
}



@end
